<template>
	<view>
		<view>
				<view v-for="(item,index) in alarmList" :key="index" >
					<button class="anniu" @click="goToDetail(item.alarmId)">
						 <view>报警名称:{{item.alarmName}}</view> 
						 类别：{{alarmType[item.alarmType].dictLabel }} 状态：{{alarmStatus[item.alarmStatus].dictLabel }}
					</button>
					</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return{
				alarmStatus:[{}],
				alarmType:[{}],
				alarmList:[{}]
			}
		},
	created() {
		this.getAlarmHistory()
	},
	methods:{
		getAlarmHistory() {
			// debugger
			// this.axios({
			//     method:"get",
			//     url:"http://localhost:8080/front/alarm/historyList/1"  ,
			// 	// window.sessionStorage.getItem("userId")
			// }).then((res) => {
			// 	this.alarmList = res.rows;
			// 	console.log(this.alarmList) 
			// })
			this.axios.get('http://localhost:8080/system/dict/data/type/alarm_type').then((res) => {
				this.alarmType = res.data.data;
			})
			this.axios.get('http://localhost:8080/system/dict/data/type/alarm_status').then((res) =>{
				this.alarmStatus = res.data.data;
			})
			this.axios.get(`http://localhost:8080/front/alarm/historyList/${uni.getStorageSync('Id')}`).then((res) => {
				this.alarmList = res.data.data;
			})

		},
		goToDetail(alarmId) {
						uni.navigateTo({
							url: '/pages/record/update' + '?alarmId=' +alarmId 
						})
					},
	}
	}
</script>

<style>
.anniu{
	height: 300rpx;
}
</style>
